package com.heima.feign.article.fallback;


import com.heima.feign.article.IArtileFeignClient;
import com.heima.model.article.dtos.ArticleCommentDto;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.comment.dtos.ApCommentDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.wemedia.dtos.StatisticsDto;
import org.springframework.stereotype.Component;

import java.util.Date;


//fegin降级访问的类
@Component
public class IArticleClientFallback implements IArtileFeignClient {
    @Override
    public ResponseResult saveArticle(ArticleDto articleDto) {
        return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,"服务器正忙，请稍后...");
    }

    @Override
    public ResponseResult queryLikesAndConllections(Integer wmUserId, Date beginDate, Date endDate) {
        return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,"服务器正忙，请稍后...");
    }

    @Override
    public PageResponseResult newPage(StatisticsDto dto) {
        return (PageResponseResult) PageResponseResult.errorResult(500, "服务器正忙，请稍后...");
    }

    @Override
    public PageResponseResult findNewsComments(ArticleCommentDto dto) {
        return (PageResponseResult) PageResponseResult.errorResult(500, "服务器正忙，请稍后...");
    }

    /**
     * 文章评论开启或关闭状态
     * @param dto
     * @return
     */
    @Override
    public ResponseResult isChannel(ApCommentDto dto) {
        return ResponseResult.errorResult(501, "服务器正忙...");
    }

    /**
     * 删除评论数,点赞数
     * @param dto
     * @return
     */
    @Override
    public ResponseResult delChannelState(ApCommentDto dto) {
        return ResponseResult.errorResult(501, "服务器正忙...");
    }

    @Override
    public ResponseResult findArticleConfigaByArticleId(Long id) {
        return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,"服务器正忙，请稍后...");
    }

    /**
     * 保存文章评论数
     * @param entryId
     */
    @Override
    public ResponseResult updateComment(Long entryId) {
        return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,"服务器正忙，请稍后...");
    }

    /**
     * 判断该文章是否开启评论
     * @param entryId
     * @return
     */
    @Override
    public ResponseResult stateComment(Long entryId) {
        return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR,"服务器正忙，请稍后...");
    }

}
